package com.sghd.football.module.game.facade.model;

import com.sghd.football.module.game.service.core.Rule;
import com.sghd.football.module.game.service.model.Medal;
import com.sghd.football.utils.json.Json;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;

/**
 * \* Created with 王创辉.
 * \* Date: 2018/5/28
 * \* Time: 14:43
 * \* @desc: 进入房间(断线重连)Vo
 */
@Json
public class JoinResult {

    private Integer[] betArea;
    private long myMoney;
    private String myName;
    private int myVip;
    private String myHeadUrl;
    private int myYaXian = Rule.size();
    private int freeCount;
    /** 总免费次数*/
    private int totalFreeCount;
    /** 奖池*/
    private Map<Integer, Long> pool;
    private long freeMoney;

    public static JoinResult valueOf(Integer[] betArea, long myMoney, String myName, int myVip, String myHeadUrl,
                                     int freeCount, int totalFreeCount, Map<Medal, AtomicLong> pool, long freeMoney){
        JoinResult result = new JoinResult();
        result.betArea = betArea;
        result.myMoney = myMoney;
        result.myName = myName;
        result.myVip = myVip;
        result.myHeadUrl = myHeadUrl;
        result.freeCount = freeCount;
        result.totalFreeCount = totalFreeCount;
        Map<Integer, Long> po = new HashMap<>();
        for (Map.Entry<Medal, AtomicLong> entry : pool.entrySet()) {
            po.put(entry.getKey().ordinal(), entry.getValue().get());
        }
        result.pool = po;
        result.freeMoney = freeMoney;
        return result;
    }

    public Integer[] getBetArea() {
        return betArea;
    }

    public void setBetArea(Integer[] betArea) {
        this.betArea = betArea;
    }

    public long getMyMoney() {
        return myMoney;
    }

    public void setMyMoney(long myMoney) {
        this.myMoney = myMoney;
    }

    public String getMyName() {
        return myName;
    }

    public void setMyName(String myName) {
        this.myName = myName;
    }

    public int getMyVip() {
        return myVip;
    }

    public void setMyVip(int myVip) {
        this.myVip = myVip;
    }

    public String getMyHeadUrl() {
        return myHeadUrl;
    }

    public void setMyHeadUrl(String myHeadUrl) {
        this.myHeadUrl = myHeadUrl;
    }

    public int getMyYaXian() {
        return myYaXian;
    }

    public void setMyYaXian(int myYaXian) {
        this.myYaXian = myYaXian;
    }

    public int getFreeCount() {
        return freeCount;
    }

    public void setFreeCount(int freeCount) {
        this.freeCount = freeCount;
    }

    public int getTotalFreeCount() {
        return totalFreeCount;
    }

    public void setTotalFreeCount(int totalFreeCount) {
        this.totalFreeCount = totalFreeCount;
    }

    public Map<Integer, Long> getPool() {
        return pool;
    }

    public void setPool(Map<Integer, Long> pool) {
        this.pool = pool;
    }

    public long getFreeMoney() {
        return freeMoney;
    }

    public void setFreeMoney(long freeMoney) {
        this.freeMoney = freeMoney;
    }
}
